﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace vlcWinForm
{
    public partial class FourVlcPlayerControl : UserControl
    {
        public FourVlcPlayerControl()
        {
            InitializeComponent();
        }

        public bool Playing()
        {
            return vlcPlayerControl1.Playing() || vlcPlayerControl2.Playing() || vlcPlayerControl3.Playing()
                || vlcPlayerControl4.Playing();
        }

        public void Close()
        {
            vlcPlayerControl1.Close();
            vlcPlayerControl2.Close();
            vlcPlayerControl3.Close();
            vlcPlayerControl4.Close();
        }

        public void Play(string fileName, int videoLen)
        {
            vlcPlayerControl1.SetTrackBarMinMax(0, videoLen / 4);
            vlcPlayerControl1.Play(fileName);
            vlcPlayerControl2.SetTrackBarMinMax(videoLen / 4, videoLen / 2);
            vlcPlayerControl2.Play(fileName);
            vlcPlayerControl3.SetTrackBarMinMax(videoLen / 2, videoLen * 3 / 4);
            vlcPlayerControl3.Play(fileName);
            vlcPlayerControl4.SetTrackBarMinMax(videoLen * 3 / 4, videoLen);
            vlcPlayerControl4.Play(fileName);
        }
    }
}
